using System;
using UnityEngine;

namespace Core.Extension
{
    /// <summary>
    /// 使该对象的生命变成可观察的
    /// </summary>
    public class ObservableLife : MonoBehaviour
    {
        public Action _OnDisable;
        public Action _OnDestroy;

        //禁用时
        private void OnDisable()
        {
            _OnDisable?.Invoke();
        }

        //销毁时
        private void OnDestroy()
        {
            _OnDestroy?.Invoke();
        }
    }
}